#! /usr/bin/env node
import { program } from 'commander'
import chalk from 'chalk'
import figlet from 'figlet'
import { createRequire } from 'module'
import { fileURLToPath } from 'node:url'
import { dirname } from 'node:path'
import { version } from './package.json'
import { CREATE_COMMAND, CONFIG_COMMAND } from './commands'
import createAction from './commands/create/action'


const commands = [
  CREATE_COMMAND,
  CONFIG_COMMAND,

]

const banner = figlet.textSync('cva', {
  font:'Alligator',
  horizontalLayout:'default',
  verticalLayout:'default',
  width:500,
  whitespaceBreak:true
})


function main() {
  program.name('cva')
    .usage('<command> [options]')
    .version(version)

  program.command('create <project-name>')
    .description('create a new vue project')
    .option('-f, --force', 'force an override of an existing project name')
    .option('-v, --version <version>', 'specify the vue version number')
    .action((name, options, command)=>{
      createAction(name, options)

    })

  program.addHelpText('beforeAll', banner)
  program.addHelpText('afterAll', chalk.blue('Run cva [command] --help for more command usage'))

  program.on('--help', ()=>{
  

  })

  program.parse(process.argv)
}

main()
